﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Client
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class newUser : Window
    {
        private static List<Canvas> CanvasList;
        int i;
        public newUser()
        {
            InitializeComponent();

            i = 0;
            CanvasList = new List<Canvas>();
            CanvasList.Add(cvsMainWindow);
            CanvasList.Add(cvsUserAgreement);
            CanvasList.Add(cvsAccountName);
            CanvasList[0].Visibility = Visibility.Visible;
        }

        private void btnNext_Click(object sender, RoutedEventArgs e)
        {

            if (i < 2)
            {
                CanvasList[i].Visibility = Visibility.Hidden;
                i = i + 1;
                CanvasList[i].Visibility = Visibility.Visible;
            }
            if (i == 2)
            {
                btnOk.Visibility = Visibility.Visible;
                btnNext.Visibility = Visibility.Hidden;
            }

        }

        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            if (i > 0)
            {
                CanvasList[i].Visibility = Visibility.Hidden;
                i = i - 1;
                CanvasList[i].Visibility = Visibility.Visible;
                btnOk.Visibility = Visibility.Hidden;
                btnNext.Visibility = Visibility.Visible;
            }
        }

        private void tbxCancel_Click(object sender, RoutedEventArgs e)
        {
            formController.ShowForm(typeof(mainWindow)); 
        }

        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            formController.userEmail(tbxEmail.Text);
            formController.userName(tbxName.Text);
            formController.userPass(tbxPass.Text);
            formController.userEmail(tbxPhone.Text);
            formController.userFirstName(tbxFirstName.Text);
            formController.userLastName(tbxLastName.Text);
            
           
            
            User user = new User();
            user.CreateUser(tbxName.Text, tbxPass.Text, "", "", tbxEmail.Text, tbxPhone.Text);
                   
        }
    }
}
